package com.boot.unity.api.modules.training.controller;

import com.boot.unity.api.common.Result;
import com.boot.unity.api.modules.training.entity.Coach;
import com.boot.unity.api.modules.training.service.CoachService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.AllArgsConstructor;
import org.springframework.web.bind.annotation.*;

//@Api(tags = "驾校-教练员")
//@RestController
//@RequestMapping("/api/coach")
@AllArgsConstructor
public class CoachController {
    private final CoachService coachService;

    @ApiOperation(value = "备案及修改教练员")
    @PostMapping
    public Result save(@RequestBody Coach coach) {
        return coachService.save(coach);
    }

    @ApiOperation(value = "删除教练员")
    @DeleteMapping("/coach-{coachnum}")
    public Result delete(@PathVariable("coachnum") String coachnum) {
        return coachService.deleteByCoachnum(coachnum);
    }

//    @GetMapping("/{id}")
//    @ApiOperation(value = "根据id获取")
//    public Coach get(@PathVariable Long id) {
//        return coachDao.getById(id);
//    }
//
//    @PutMapping
//    @ApiOperation(value = "修改")
//    public Coach update(@RequestBody Coach coach) {
//        coachDao.update(coach);
//
//        return coach;
//    }
//
//    @GetMapping
//    @ApiOperation(value = "列表")
//    public PageTableResponse list(PageTableRequest tableRequest) {
//        return new PageTableHandler(
//                request -> coachDao.count(request.getParams()),
//                request -> coachDao.list(request.getParams(), request.getOffset(), request.getLimit())
//        ).handle(tableRequest);
//    }
//
}
